﻿using BBICMS.Repository;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;

namespace BBICMS.WebUI
{
    public class RouteConfig
    {
        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            routes.MapMvcAttributeRoutes();

            routes.MapRoute(
             name: "ErrorPage",
             url: "Error/{action}",
             defaults: new { controller = "Error", action = "Index" },
             namespaces: new string[] { "BBICMS.WebUI.Controllers" }

         );



            routes.MapRoute(
                name: "PageRoute",
                url: "{culture}/pages/{seoName}",
                defaults: new { culture = LanguageHelper.GetDefaultCulture(), controller = "Page", action = "DetailsSEO" },
                namespaces: new string[] { "BBICMS.WebUI.Controllers" }
            );


            routes.MapRoute(
                name: "Default",
                url: "{culture}/{controller}/{action}/{id}",
                   constraints: new { culture = @"(\w{2})|(\w{2}-\w{2})" },   // en or en-US
                defaults: new { culture = LanguageHelper.GetDefaultCulture(), controller = "Home", action = "Index", id = UrlParameter.Optional },
                namespaces: new string[] { "BBICMS.WebUI.Controllers" }
            );

            routes.MapRoute(
                name: "DefaultOK",
                url: "{controller}/{action}/{id}",
                defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional },
                namespaces: new string[] { "BBICMS.WebUI.Controllers" }
            );

          


        }
    }
}